//区县分项目人数，金额
var myChart2 = echarts.init(document.getElementById('map1-b'));

var xAxisData = [];
var data1_leftCenter = [];
var data2_leftCenter = [];
    $.each(dataCounty.zone,function(i,n){
        data1_leftCenter.push(parseInt(n.NumPeople)/1000)
    })
    $.each(dataCounty.zone,function(i,n){
        data2_leftCenter.push(parseInt(n.Money)/1000000)
    })
// console.log(dataCounty)
// console.log(data1_leftCenter)
// console.log(data2_leftCenter)

var option2 = {
    title: {
        text: functionTitle(dataCounty),
        textStyle: {
            color: '#1da1f2',
            fontSize: '12'
        }
    },
        tooltip : {
            trigger: 'axis',
            axisPointer: {
                crossStyle: {
                    color: '#999'
                }
            }
    },
    legend: 
    {
        textStyle:{
            color:"#fff",
        },
        data:['发放人数','发放资金'],
    },
    dataZoom: [{
        type: 'inside',
        start: 0,
        end: 50
    }, {
        start: 0,
        end: 50,
        handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
        handleSize: '80%',
        color: '#fff',
        handleStyle: {
            color: '#fff',
            shadowBlur: 3,
            shadowColor: 'rgba(0, 0, 0, 0.6)',
            shadowOffsetX: 2,
            shadowOffsetY: 2
        }
    }],
    grid: {
        left: '2%',
        right: '2%',
        bottom: '20%',
        containLabel: true
    },
    xAxis: [
        {
            axisLabel:{
                interval : 0, 
                textStyle: {
                    color: '#fff'
                }
            },
            splitLine: {
                show: false
            },
            type: 'category',
            data: functionZone(dataCounty),
            axisPointer: {
                type: 'shadow',
                alignWithLabel: true
            },
            nameTextStyle:{
                color:"#fff"
            },
        }
        
    ],
    yAxis: [
        {
            splitLine: {
                show: false
            },
            type: 'value',
            name: '发放人数',
            nameTextStyle:{
                color:"#fff"
            },
            color:["#fff"],
            min: 0,
            interval: 25,
            axisLabel: {
                formatter: '{value} 千人',
                color: '#fff'
            }
        }
        ,
        {
            splitLine: {
                show: false
            },
            type: 'value',
            name: '发放资金',
            nameTextStyle:{
                color:"#fff"
            },
            color:["#fff"],
            min: 0,
            interval: 10,
            axisLabel: {
                formatter: '{value} 百万',
                color:"#fff"
            }
        }
    ],
    series: 
    [
        {
            name:'发放人数',
            type:'bar',
            barCategoryGap:'40%',
            data:[]
        },
        {
            name:'发放资金',
            type:'line',
            yAxisIndex: 1,
            data:[]
        }
    ]
}
function functionZone(dataCounty){
    var xAxisData = [];
    for(var a = 0;a <dataCounty.zone.length;a++){
        xAxisData.push(dataCounty.zone[a].Project);
    }
    return xAxisData;
 }
 function functionTitle(dataCounty){
     var titelName=dataCounty.title;
     return titelName;
 }
 myChart2.setOption(option2);
// setTimeout(function(){
    
//     myChart2.setOption({
//         series: [
//             {
//                 name:'发放人数',
//                 type:'bar',
//                 data:data1
//             },
//             {
//                 name:'发放资金',
//                 type:'line',
//                 yAxisIndex: 1,
//                 data:data2
//             }
//         ]
//     });
// },1500)

